//==============================================================================
//
// Title:       PowerMeter.h
// Purpose:     A short description of the interface.
//
// Created on:  2012-4-20 at 14:52:52 by luh.
// Copyright:   dafda. All Rights Reserved.
//
//==============================================================================

#ifndef __PowerMeter_H__
#define __PowerMeter_H__

#ifdef __cplusplus
    extern "C" {
#endif

//==============================================================================
// Include files

#include "cvidef.h"

#define nrpErrChk(fCall)\
\
if((viStatus = (fCall)) != 0) {\
   if(g_hPowerMeter != 0)\
      rsnrpz_error_message (g_hPowerMeter, viStatus, errMsg);\
   else\
      sprintf(errMsg, "NRP call failed ! Error code: %ld", viStatus);\
   if(viStatus < 0) error = -1;\
   if(error < 0) goto Error;\
} else
//==============================================================================
// Types

//==============================================================================
// External variables
extern ViSession   g_hPowerMeter;
//==============================================================================
// Global functions
// PowerMeter function prototypes
int InitPowerMeter( void );
int CVICALLBACK PowerMeterInitThreadFunc( void* functionData );
int SetPowerMeterFrequency( ViSession   hPowerMeter,double dFrequency);
int MeasureOutputPower( int iTx, double dMinLimit, double dMaxLimit, double* pdOutputPower );
int MeasurePower( int iSensor, double dDelay, double dToleranceInDbm, double* pdOutputInDbm );

double DBmToMicroWatts( double dDbm );
double WattsToDBm( double dWatts );
#ifdef __cplusplus
    }
#endif

#endif  /* ndef __PowerMeter_H__ */
